package com.wgtgt.multiplication;

/**
 * Hello world!
 *
 */
public class App2 {
	public static void main(String[] args) {
		System.out.println("Hello World!");
		int n = 1;
		// ab * cd
		// 235种结果
		int last = 0;
		int count = 0;
		for (int a = 1; a <= 9; a++) {
			for (int b = 1; b <= 9; b++) {
				for (int c = 1; c <= 9; c++) {
					for (int d = 1; d <= 9; d++) {
						int ac = a * c;
						int ad = a * d;
						int bc = b * c;
						int bd = b * d;
						int e4 = bd % 10;
						int e3 = ad % 10 + bc % 10 + bd / 10;
						int e2 = ad / 10 + bc / 10 + ac % 10;
						int e1 = ac / 10;
						int ee3 = 0;
						int ee2 = e2 % 10;
						if (e3 >= 10) {
							ee3 = e3 / 10;
							if (ee2 + ee3 >= 10) {
								int ab = a * 10 + b;
								int cd = c * 10 + d;
								String numStr = n + "";
								if (n < 10) {
									numStr = "0" + n;
								}
								String str = ab + " * " + cd + " = " + (ab * cd);
								str = numStr + " " + str;
								if (ab >= cd) {
									if (ab != last) {
										str = str + " >> " + count;
										count = 0;
									} else {
										count++;
									}
									System.out.println(str);
									last = ab;
									n++;
								}
							}
						}
					}
				}
			}
		}
	}
}
